package com.aliware.tianchi.loadbalance;

public class WeightNode<T> {


    /**
     * 绑定对象
     */
    private T value;
    /**
     * 范围 start
     */
    private double start;
    /**
     * 范围 end
     */
    private double end;
    /**
     * 平均值
     */
    private double avg;
    /**
     * 容量
     */
    private double channels;

    public WeightNode(double avg,double channels, T value) {
        init(avg, channels, value);
    }

    public void init(double avg,double channels, T value){
        this.avg = avg;
        this.value = value;
        this.channels = channels;
    }

    public WeightNode() {
    }

    public T getValue() {
        return value;
    }

    public void setAround(double start,double end){
        this.start = start;
        this.end = end;
    }

    public boolean exist(double val){
        return val>=start&&val<end;
    }

    public double getAvg() {
        return avg;
    }

    public double getChannels() {
        return channels;
    }
}
